package com.fesine.batch.controller;

import com.fesine.batch.service.BatchSchedulerBrokerService;
import com.fesine.commons.util.ResponseUtils;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2017/3/5 0:52
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2017/3/5 0:52
 */
@Controller
@RequestMapping("/timePlan")
public class TimePlanController {

    protected static final Logger logger = LoggerFactory.getLogger(TimePlanController.class);

    @Autowired
    private BatchSchedulerBrokerService batchSchedulerBroker;

    @RequestMapping("/listAll")
    public void listAll(HttpServletRequest request, HttpServletResponse response) throws
            Exception {
        logger.debug("------>接受分页查询请求:");
        Map<String, Object> map;
        try {
            map = new HashedMap();
            map.put("list", batchSchedulerBroker.listScheduledGroups());
        } catch (Exception e) {
            logger.error("", e);
            throw e;
        }
        ResponseUtils.outPut(response, map);
    }
}
